package weather.language.forecast;

import java.util.*;
public abstract class WeatherGroup implements Comparable<WeatherGroup>

{
	public WeatherGroup(String id)
	{
		this.id = id;
	}
	
	public WeatherGroup(String id, Set<String> keywordsSet)
	{
		this(id);
		for (String kw: keywordsSet)
			this.keywordsSet.add(kw);
	}

	public String getId()
	{
		return id;
	}
	
	public String[] getKeywords()
	{
		return keywordsSet.toArray(new String[0]);
	}
	
	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		
		return result;
	}
	@Override
	public int compareTo(WeatherGroup o) 
	{
		return id.compareTo(o.id);
	}
	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		
		WeatherGroup other = (ConditionsGroup) obj;
		
		if (id == null)
		{
			if (other.id != null)
				return false;
		}
		else if (!id.equals(other.id))
			return false;
		
		return true;
	}
	
	public String toString()
	{
		return id;
	}
	
	public abstract void prepareQuestion(WeatherQuestion weatherQ);
	
	private String id;
	private Set<String> keywordsSet = new HashSet<String>();
}
